﻿<%@ Page Title="Frontdesk - Your Forms" Language="C#" MasterPageFile="~/Views/Shared/Frontdesk.Master"
    Inherits="System.Web.Mvc.ViewPage<IEnumerable<Sendz.Domain.Form>>" %>

<asp:Content ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
    <% if (Model.Count() == 0)
       { %>
    <h2 class="title">
        Forms Here! Get Your Forms!</h2>
    <div class="create">
        <div class="create-link">
            <%: Html.ActionLink("Create a Form!", "Create", null, new { @title = "Create a new form" }) %></div>
    </div>
    <p class="justify clear">
        Forms let you collect data. You can then have AutoResponders reply to folks who
        fill out your forms, automatically! But, you don't have any forms created. Creating
        a form is so easy, even a monkey could do it. Go ahead and try one!</p>
    <% if (Convert.ToBoolean(ViewData.Eval("IsNewUser")))
       { %>
    <p class="caption justify critical fullborder">
        Since you are a new user, when you create your first form, we are going to walk
        you through the steps of creating a form, then an autoresponder, and then linking
        them together. This will only happen the first time you create a form and an autoresponder...
        after that you will know the process!</p>
    <% } %>
    <p class="justify">
        <%: Html.ActionLink("Click here to make a new form now!", "Create", null, new { @title = "Create a new form" }) %></p>
    <% }
       else
       { %>
    <h2 class="title">
        Your Forms</h2>
    <div class="create">
        <div class="create-link">
            <%: Html.ActionLink("Create a Form!", "Create", null, new { @title = "Create a new form" }) %></div>
    </div>
    <p class="justify clear">
        Click on any form to edit it, or click on the 'Actions' link below to see all the
        cool choices at your disposal... We do so much to help you collect data, we're ashamed
        of ourselves.</p>
    <div class="list">
        <% foreach (var form in Model)
           {%>
        <div class="list-item">
            <div class="list-item-link">
                <%: Html.ActionLink(form.Name, "Edit", new { id = form.FormKey }, new { title = "Edit this form" }) %>
            </div>
            <div class="menu">
                <span class="actions" title="Click to display the actions you can use for this form">
                    Actions&nbsp;<img src="<%= Url.Content("~/Content/Frontdesk/dropdown.gif") %>" alt="View options" /></span>
                <ul class="nav">
                    <li>
                        <a href="http://<%: ViewData["DomainShort"] %>/<%: form.ShortPath %>" target="_new" title="Preview the form as a user would see it">Display Form</a>
                    <li>
                        <%: Html.ActionLink("Get Tag", "GetTag", new { id = form.FormKey }, new { title = "Get a tag to embed the form on your web page", @class = "modal" })%></li>
                    <li>
                        <%: Html.ActionLink("Edit Form", "Edit", new { id = form.FormKey }, new { title = "Edit this form" })%></li>
                    <li>
                        <%: Html.ActionLink("Edit Fields", "EditFields", new { id = form.FormKey }, new { title = "Edit this form's fields" })%></li>
                    <li>
                        <%: Html.ActionLink("Export PDF", "Export", new { id = form.FormKey, exportFormat = "pdf" }, new { title = "Export form data as a PDF" })%></li>
                    <li>
                        <%: Html.ActionLink("Export CSV", "Export", new { id = form.FormKey, exportFormat = "csv" }, new { title = "Export form data as a spreadsheet" })%></li>
                    <li>
                        <%: Html.ActionLink("Remove", "Remove", new { id = form.FormKey }, new { title = "Remove this form", onclick = "return confirm('Are you sure? Removing a form will make it unavailable for reporting too!');" })%></li>
                </ul>
            </div>
        </div>
        <%
            }%>
    </div>
    <% } %>
</asp:Content>
<asp:Content ContentPlaceHolderID="Sidebar" runat="server">
    <% Html.RenderPartial("videohelp"); %>
</asp:Content>
<asp:Content ContentPlaceHolderID="footer" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            $("div.menu span").click(function () {
                $(this).parent().find("ul.nav").slideDown('fast').show(); // Drop down the subnav on click
                $(this).parent().hover(function () { }, function () {
                    $(this).parent().find("ul.nav").slideUp(); // When the mouse hovers out of the subnav, move it back up
                });
            });
        });
    </script>
</asp:Content>
